<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('auth','TestController@test');


//Route::get('/', function () {
//    return view('welcome');
//});
//返回登录页面的路由
Route::get('admin/login','Admin\LoginController@login');
//提交登录数据的路由
Route::post('admin/login','Admin\LoginController@dologin');
//验证码
Route::get('admin/login/code','Admin\LoginController@code');
//Route::resource('admin/login','Admin\LoginController');
//Route::get('test','Admin\LoginController@test');

Route::get('/code/captcha/{tmp}', 'Admin\LoginController@captcha');
//密码测试路由
Route::get('secret','Admin\LoginController@secret');

Route::group(['prefix'=>'admin','namespace'=>'Admin','middleware'=>['hasrole']],function(){
    Route::get('index','IndexController@index');
    Route::get('info','IndexController@info');
//    修改密码
    Route::get('pass','IndexController@pass');
    Route::post('pass','IndexController@dopass');
//    退出登录
    Route::get('logout','IndexController@logout');
    //用户模块相关路由
    Route::resource('user','UserController');
    Route::post('user/auth','UserController@auth');


    Route::controller('abc','AbcController');

    //分类模块相关路由
    Route::resource('cate','CateController');
    Route::post('cate/changeorder','CateController@changeOrder');


//    文章模块
    Route::resource('article','ArticleController');
    Route::post('upload','ArticleController@Upload');

    Route::post('article/update/{id}','ArticleController@update');

//    网站配置
    Route::get('config/putfile','ConfigController@putFile');
    Route::resource('config','ConfigController');
    Route::post('config/changecontent','ConfigController@changeContent');


//    角色路由
    Route::resource('role','RoleController');
    Route::post('role/auth','RoleController@auth');
//    权限路由
    Route::resource('permission','PermissionController');



});

Route::get('test','TestController@index');

//网站前台路由
Route::get('/','Home\IndexController@index');
Route::get('/cate/{id}','Home\IndexController@lists');
Route::get('/a/{id}','Home\IndexController@news');
Route::resource('/admin/imgs','Admin\ImgsController');
Route::resource('/admin/link','Admin\LinkController');
/*//如果需要一个添加页面，使用这条路由
Route::get('admin/create','Admin\LoginController@create');
//如果提交添加数据，使用这条路由
Route::post('admin','Admin\LoginController@store');
//如果显示列表数据，使用这条路由
Route::get('admin','Admin\LoginController@index');
//如果返回修改页面，使用这条路由
Route::get('admin/{id}/edit','Admin\LoginController@edit');
//如果保存修改，使用这条路由
Route::put('admin/{id}','Admin\LoginController@update');
//如果删除一条记录，使用这条路由
Route::delete('admin/{id}','Admin\LoginController@destroy');
//如果显示一条记录，使用这条路由
Route::get('admin/{id}','Admin\LoginController@show');*/